home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / PInterfaces / FindByContent.p < prev    next >
Encoding:
Text File  |  1998-08-17  |  9.4 KB  |  235 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        FindByContent.p
  3.  
  4.      Contains:    Public search interface for the Find by Content shared library
  5.  
  6.      Version:    Technology:    2.0
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1997-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. }
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT FindByContent;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __FINDBYCONTENT__}
  27. {$SETC __FINDBYCONTENT__ := 1}
  28.  
  29. {$I+}
  30. {$SETC FindByContentIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33. {$IFC UNDEFINED __MACTYPES__}
  34. {$I MacTypes.p}
  35. {$ENDC}
  36. {$IFC UNDEFINED __FILES__}
  37. {$I Files.p}
  38. {$ENDC}
  39.  
  40.  
  41. {$PUSH}
  42. {$ALIGN MAC68K}
  43. {$LibExport+}
  44.  
  45.  
  46. CONST
  47.     gestaltFBCIndexingState        = 'fbci';                        {  Find By Content indexing state }
  48.     gestaltFBCindexingSafe        = 0;                            {  any search will result in synchronous wait }
  49.     gestaltFBCindexingCritical    = 1;                            {  any search will execute immediately }
  50.  
  51.     gestaltFBCVersion            = 'fbcv';                        {  Find By Content version }
  52.     gestaltFBCCurrentVersion    = $0011;                        {  First release  }
  53.  
  54.  
  55. {
  56.    ***************************************************************************
  57.    Phase values
  58.    These values are passed to the client's callback function to indicate what
  59.    the FBC code is doing.
  60.    ***************************************************************************
  61. }
  62.                                                                 {  indexing phases }
  63.     kFBCphIndexing                = 0;
  64.     kFBCphFlushing                = 1;
  65.     kFBCphMerging                = 2;
  66.     kFBCphMakingIndexAccessor    = 3;
  67.     kFBCphCompacting            = 4;
  68.     kFBCphIndexWaiting            = 5;                            {  access phases }
  69.     kFBCphSearching                = 6;
  70.     kFBCphMakingAccessAccessor    = 7;
  71.     kFBCphAccessWaiting            = 8;                            {  summarization }
  72.     kFBCphSummarizing            = 9;                            {  indexing or access }
  73.     kFBCphIdle                    = 10;
  74.     kFBCphCanceling                = 11;
  75.  
  76. {
  77.    ***************************************************************************
  78.    FBC errors are assigned in the range -30500 to -30539, inclusive.
  79.    ***************************************************************************
  80. }
  81.  
  82.     kFBCvTwinExceptionErr        = -30500;                        { no telling what it was }
  83.     kFBCnoIndexesFound            = -30501;
  84.     kFBCallocFailed                = -30502;                        { probably low memory }
  85.     kFBCbadParam                = -30503;
  86.     kFBCfileNotIndexed            = -30504;
  87.     kFBCbadIndexFile            = -30505;                        { bad FSSpec, or bad data in file }
  88.     kFBCcompactionFailed        = -30506;                        { V-Twin exception caught }
  89.     kFBCvalidationFailed        = -30507;                        { V-Twin exception caught }
  90.     kFBCindexingFailed            = -30508;                        { V-Twin exception caught }
  91.     kFBCcommitFailed            = -30509;                        { V-Twin exception caught }
  92.     kFBCdeletionFailed            = -30510;                        { V-Twin exception caught }
  93.     kFBCmoveFailed                = -30511;                        { V-Twin exception caught }
  94.     kFBCtokenizationFailed        = -30512;                        { couldn't read from document or query }
  95.     kFBCmergingFailed            = -30513;                        { couldn't merge index files }
  96.     kFBCindexCreationFailed        = -30514;                        { couldn't create index }
  97.     kFBCaccessorStoreFailed        = -30515;
  98.     kFBCaddDocFailed            = -30516;
  99.     kFBCflushFailed                = -30517;
  100.     kFBCindexNotFound            = -30518;
  101.     kFBCnoSearchSession            = -30519;
  102.     kFBCindexingCanceled        = -30520;
  103.     kFBCaccessCanceled            = -30521;
  104.     kFBCindexFileDestroyed        = -30522;
  105.     kFBCindexNotAvailable        = -30523;
  106.     kFBCsearchFailed            = -30524;
  107.     kFBCsomeFilesNotIndexed        = -30525;
  108.     kFBCillegalSessionChange    = -30526;                        { tried to add/remove vols to a session }
  109.                                                                 { that has hits }
  110.     kFBCanalysisNotAvailable    = -30527;
  111.     kFBCbadIndexFileVersion        = -30528;
  112.     kFBCsummarizationCanceled    = -30529;
  113.     kFBCindexDiskIOFailed        = -30530;
  114.     kFBCbadSearchSession        = -30531;
  115.     kFBCnoSuchHit                = -30532;
  116.  
  117.  
  118. {
  119.    ***************************************************************************
  120.    Pointer types
  121.    These point to memory allocated by the FBC shared library, and must be deallocated
  122.    by calls that are defined below.
  123.    ***************************************************************************
  124. }
  125.  
  126. {  A collection of state information for searching }
  127.  
  128. TYPE
  129.     FBCSearchSession = ^LONGINT;
  130. {  a FBCWordList is a pointer to an array of pointers to c-strings }
  131.     FBCWordListRecPtr = ^FBCWordListRec;
  132.     FBCWordListRec = RECORD
  133.         words:                    ARRAY [0..0] OF ConstCStringPtr;        {  array of pointers to c-strings }
  134.     END;
  135.  
  136.     FBCWordList                            = ^FBCWordListRec;
  137. {
  138.    ***************************************************************************
  139.    Callback function type for progress reporting and cancelation during
  140.    searching and indexing.  The client's callback function should call
  141.    WaitNextEvent; a "sleep" value of 1 is suggested.  If the callback function
  142.    wants to cancel the current operation (indexing, search, or doc-terms
  143.    retrieval) it should return true.
  144.    ***************************************************************************
  145. }
  146.  
  147. {$IFC TYPED_FUNCTION_POINTERS}
  148.     FBCCallbackProcPtr = FUNCTION(phase: UInt16; percentDone: Single; data: UNIV Ptr): BOOLEAN; C;
  149. {$ELSEC}
  150.     FBCCallbackProcPtr = ProcPtr;
  151. {$ENDC}
  152.  
  153. {
  154.    ***************************************************************************
  155.    Set the callback function for progress reporting and cancelation during
  156.    searching and indexing, and set the amount of heap space to reserved for
  157.    the client's use when FBC allocates memory.
  158.    ***************************************************************************
  159. }
  160. PROCEDURE FBCSetCallback(fn: FBCCallbackProcPtr; data: UNIV Ptr); C;
  161. PROCEDURE FBCSetHeapReservation(bytes: UInt32); C;
  162. {
  163.    ***************************************************************************
  164.    Find out whether a volume is indexed, the date & time of its last
  165.    completed  update, and its physical size.
  166.    ***************************************************************************
  167. }
  168.  
  169. FUNCTION FBCVolumeIsIndexed(theVRefNum: SInt16): BOOLEAN; C;
  170. FUNCTION FBCVolumeIsRemote(theVRefNum: SInt16): BOOLEAN; C;
  171. FUNCTION FBCVolumeIndexTimeStamp(theVRefNum: SInt16; VAR timeStamp: UInt32): OSErr; C;
  172. FUNCTION FBCVolumeIndexPhysicalSize(theVRefNum: SInt16; VAR size: UInt32): OSErr; C;
  173. {
  174.    ***************************************************************************
  175.    Create & configure a search session
  176.    ***************************************************************************
  177. }
  178.  
  179. FUNCTION FBCCreateSearchSession(VAR searchSession: FBCSearchSession): OSErr; C;
  180. FUNCTION FBCAddAllVolumesToSession(theSession: FBCSearchSession; includeRemote: BOOLEAN): OSErr; C;
  181. FUNCTION FBCSetSessionVolumes(theSession: FBCSearchSession; {CONST}VAR vRefNums: SInt16; numVolumes: UInt16): OSErr; C;
  182. FUNCTION FBCAddVolumeToSession(theSession: FBCSearchSession; vRefNum: SInt16): OSErr; C;
  183. FUNCTION FBCRemoveVolumeFromSession(theSession: FBCSearchSession; vRefNum: SInt16): OSErr; C;
  184. FUNCTION FBCGetSessionVolumeCount(theSession: FBCSearchSession; VAR count: UInt16): OSErr; C;
  185. FUNCTION FBCGetSessionVolumes(theSession: FBCSearchSession; VAR vRefNums: SInt16; VAR numVolumes: UInt16): OSErr; C;
  186. FUNCTION FBCCloneSearchSession(original: FBCSearchSession; VAR clone: FBCSearchSession): OSErr; C;
  187. {
  188.    ***************************************************************************
  189.    Execute a search
  190.    ***************************************************************************
  191. }
  192.  
  193. FUNCTION FBCDoQuerySearch(theSession: FBCSearchSession; queryText: CStringPtr; {CONST}VAR targetDirs: FSSpec; numTargets: UInt32; maxHits: UInt32; maxHitWords: UInt32): OSErr; C;
  194. FUNCTION FBCDoExampleSearch(theSession: FBCSearchSession; {CONST}VAR exampleHitNums: UInt32; numExamples: UInt32; {CONST}VAR targetDirs: FSSpec; numTargets: UInt32; maxHits: UInt32; maxHitWords: UInt32): OSErr; C;
  195. FUNCTION FBCBlindExampleSearch(VAR examples: FSSpec; numExamples: UInt32; {CONST}VAR targetDirs: FSSpec; numTargets: UInt32; maxHits: UInt32; maxHitWords: UInt32; allIndexes: BOOLEAN; includeRemote: BOOLEAN; VAR theSession: FBCSearchSession): OSErr; C;
  196.  
  197. {
  198.    ***************************************************************************
  199.    Get information about hits [wrapper for THitItem C++ API]
  200.    ***************************************************************************
  201. }
  202.  
  203. FUNCTION FBCGetHitCount(theSession: FBCSearchSession; VAR count: UInt32): OSErr; C;
  204. FUNCTION FBCGetHitDocument(theSession: FBCSearchSession; hitNumber: UInt32; VAR theDocument: FSSpec): OSErr; C;
  205. FUNCTION FBCGetHitScore(theSession: FBCSearchSession; hitNumber: UInt32; VAR score: Single): OSErr; C;
  206. FUNCTION FBCGetMatchedWords(theSession: FBCSearchSession; hitNumber: UInt32; VAR wordCount: UInt32; VAR list: FBCWordList): OSErr; C;
  207. FUNCTION FBCGetTopicWords(theSession: FBCSearchSession; hitNumber: UInt32; VAR wordCount: UInt32; VAR list: FBCWordList): OSErr; C;
  208.  
  209. {
  210.    ***************************************************************************
  211.    Summarize a buffer of text
  212.    ***************************************************************************
  213. }
  214.  
  215. FUNCTION FBCSummarize(inBuf: UNIV Ptr; inLength: UInt32; outBuf: UNIV Ptr; VAR outLength: UInt32; VAR numSentences: UInt32): OSErr; C;
  216. {
  217.    ***************************************************************************
  218.    Deallocate hit lists, word arrays, and search sessions
  219.    ***************************************************************************
  220. }
  221.  
  222. FUNCTION FBCReleaseSessionHits(theSession: FBCSearchSession): OSErr; C;
  223. FUNCTION FBCDestroyWordList(theList: FBCWordList; wordCount: UInt32): OSErr; C;
  224. FUNCTION FBCDestroySearchSession(theSession: FBCSearchSession): OSErr; C;
  225. {$ALIGN RESET}
  226. {$POP}
  227.  
  228. {$SETC UsingIncludes := FindByContentIncludes}
  229.  
  230. {$ENDC} {__FINDBYCONTENT__}
  231.  
  232. {$IFC NOT UsingIncludes}
  233.  END.
  234. {$ENDC}
  235.